import request from '@/utils/request_zc'

export function getSaleOrderList ({
  page,
  limit,
  orderNo,
  customerName,
  deliverStartDate,
  deliverEndDate,
  applyStatus,
  applyUser,
  applyStartTime,
  applyEndTime,
  approveUser,
  approveStartTime,
  approveStatus,
  approveEndTime }) {
  return request({
    url: '/sales/order/list',
    method: 'get',
    params: {
      page,
      limit,
      orderNo,
      customerName,
      deliveryStartDate: deliverStartDate,
      deliveryEndDate: deliverEndDate,
      applyStatus,
      applyUser,
      applyStartTime,
      applyEndTime,
      approveUser,
      approveStartTime,
      approveStatus,
      approveEndTime
    }
  })
}

export function editSaleOrder (data) {
  return request({
    url: '/sales/order/edit',
    method: 'post',
    data
  })
}

export function getApplyApproveUserList () {
  return request({
    url: '/user/list',
    method: 'get'
  })
}

export function addSaleOrder (data) {
  return request({
    url: '/sales/order/add',
    method: 'post',
    data
  })
}

export function delSaleOrder ({ ids }) {
  return request({
    url: '/sales/order/del',
    method: 'post',
    data: {
      ids
    }
  })
}

export function editProductModeling (data) {
  return request({
    url: '/product/model/edit',
    method: 'post',
    data
  })
}

export function getCustomerList ({ page, limit, name, contact, category }) {
  return request({
    url: '/customer/list',
    method: 'get',
    params: {
      page,
      limit,
      name,
      contact,
      category
    }
  })
}

export function addProductModeling (data) {
  return request({
    url: '/product/model/add',
    method: 'post',
    data
  })
}

export function getMaterialCategoryList () {
  return request({
    url: '/material/category/list',
    method: 'get'
  })
}

export function getMaterialList ({ pid }) {
  return request({
    url: '/material/list',
    method: 'get',
    params: {
      pid
    }
  })
}
